import React, { Component } from 'react'
import { Form, Input, Select } from 'antd'
import PropTypes from "prop-types"
const Item = Form.Item
const Option = Select.Option
class ProductForm extends Component {

    static propTypes = {
        items: PropTypes.object.isRequired,
        setForm: PropTypes.func.isRequired
    }
    componentWillMount() {
        this.props.setForm(this.props.form)
    }
    render() {
        const { getFieldDecorator } = this.props.form;
        return (
            <Form labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
                <Item label="名称">
                    {getFieldDecorator('name', {
                        rules: [{ required: true, message: '请输入名称' }],
                    })(<Input placeholder="请输入" />)}

                </Item>
                <Item label="分类">
                    {getFieldDecorator('range', {
                        rules: [{ required: true, message: '请选择' }],
                        initialValue: '0'
                    })(<Select>
                        <Option value={'0'}>一级列表</Option>
                        <Option value={'1'}>二级列表</Option>
                    </Select>)}

                </Item>
            </Form>
        )
    }
}

export default Form.create()(ProductForm)